<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class proses_aktifitas_model extends CI_Model {

	function __construct()
	{
		parent::__construct();
		$this->CI = get_instance();
	}
	
	function insert($data){
		$this->db->insert('proses_aktifitas',$data);
	}
	
	function get_proses_aktifitas() {
        $this->db->select("*");
        $this->db->from('proses_aktifitas');
        $query = $this->db->get();
        return $query;
    }
	
	function get_data_proses_aktifitas() {
        //Select table name
        $table_name = "proses_aktifitas";

        //Build contents query
        $this->db->select('*')->from($table_name);
		// $this->db->where('id_bagian_jenis_aktifitas',$id_bja);
		
        $this->CI->flexigrid->build_query();

        //Get contents
        $return['records'] = $this->db->get();

        //Build count query
        $this->db->select('*')->from($table_name);
		// $this->db->where('id_bagian_jenis_aktifitas',$id_bja);
		$this->CI->flexigrid->build_query(FALSE);

        $return['record_count'] = $this->db->count_all_results();

        //Return all
        return $return;
    }
	
	function get_data_proses_aktifitas_by_bja($ids)
	{
		$this->db->select("*");
		$this->db->from('proses_aktifitas');
		$this->db->where('id_satuan_jenis_aktifitas',$ids);
		$query = $this->db->get();
		return $query;
	}
	
	function delete($id)
	{
		$this->db->where('id_proses_aktifitas', $id);
		$this->db->delete('proses_aktifitas');
	}
	
	function selectone($id)
	{
		$this->db->select("*");
		$this->db->from('proses_aktifitas');
		$this->db->where('id_proses_aktifitas',$id);
		$query = $this->db->get();
		return $query;
	}
	
	function update($id, $data)
	{
		$this->db->where('id_proses_aktifitas',$id);
		$this->db->update('proses_aktifitas',$data);
	}

}

?>